package org.dromara.iot.enums;

import lombok.Getter;

/**
 * 门状态枚举
 */
@Getter
public enum DoorStatusEnum {
    CLOSED(0, "关闭"),
    OPEN(1, "打开"),
    UNKNOWN(2, "未知状态");

    private final int code;
    private final String description;

    DoorStatusEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    /**
     * 根据code获取枚举
     */
    public static DoorStatusEnum getByCode(int code) {
        for (DoorStatusEnum status : values()) {
            if (status.code == code) {
                return status;
            }
        }
        return null;
    }
}